﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Commerce.Base.Ubl.DataType
{
    /// <summary>
    /// A character string to identify and distinguish uniquely, one instance of an object in an identification scheme from all other objects in the same scheme together with relevant supplementary information.
    /// </summary>
    [Serializable]
    public class Identifier : IConvertible
    {
        private System.String value;
        private System.String schemeId;
        private System.String schemeName;
        private System.String schemeAgencyId;
        private System.String schemeAgencyName;
        private System.String schemeVersionId;
        private System.String schemeDataUri;
        private System.String schemeUri;

        /// <summary>
        /// The identifier value.
        /// </summary>
        public System.String Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        /// <summary>
        /// The identification of the identification scheme.
        /// </summary>
        public System.String SchemeId
        {
            get { return schemeId; }
            set { schemeId = value; }
        }
        
        /// <summary>
        /// The name of the identification scheme.
        /// </summary>
        public System.String SchemeName
        {
            get { return schemeName; }
            set { schemeName = value; }
        }
        
        /// <summary>
        /// The identification of the agency that maintains the identification scheme.
        /// </summary>
        public System.String SchemeAgencyId
        {
            get { return schemeAgencyId; }
            set { schemeAgencyId = value; }
        }
        
        /// <summary>
        /// The name of the agency that maintains the identification scheme.
        /// </summary>
        public System.String SchemeAgencyName
        {
            get { return schemeAgencyName; }
            set { schemeAgencyName = value; }
        }
        
        /// <summary>
        /// The version of the identification scheme.
        /// </summary>
        public System.String SchemeVersionId
        {
            get { return schemeVersionId; }
            set { schemeVersionId = value; }
        }
        
        /// <summary>
        /// The Uniform Resource Identifier that identifies where the identification scheme data is located.
        /// </summary>
        public System.String SchemeDataUri
        {
            get { return schemeDataUri; }
            set { schemeDataUri = value; }
        }
        
        /// <summary>
        /// The Uniform Resource Identifier that identifies where the identification scheme is located
        /// </summary>
        public System.String SchemeUri
        {
            get { return schemeUri; }
            set { schemeUri = value; }
        }

        public Identifier(System.String value)
        {
            this.value = value;
        }

        public override string ToString()
        {
            return this.value;
        }

        public static implicit operator Identifier(System.String value)
        {
            return new Identifier(value);
        }
        public static implicit operator Identifier(System.Int32 value)
        {
            return new Identifier(value.ToString());
        }
        public static implicit operator Identifier(System.Decimal value)
        {
            return new Identifier(value.ToString());
        }

        public static implicit operator System.String(Identifier identifier)
        {
            if (identifier == null)
                return null;
            else
                return identifier.value;
        }

        #region IConvertible Members

        public TypeCode GetTypeCode()
        {
            return TypeCode.String;
        }

        public bool ToBoolean(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public byte ToByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public char ToChar(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public System.DateTime ToDateTime(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public decimal ToDecimal(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public double ToDouble(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public short ToInt16(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public int ToInt32(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public long ToInt64(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public sbyte ToSByte(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public float ToSingle(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public string ToString(IFormatProvider provider)
        {
            return this.ToString();
        }

        public object ToType(Type conversionType, IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public ushort ToUInt16(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public uint ToUInt32(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        public ulong ToUInt64(IFormatProvider provider)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
